<%@ page contentType="text/html; charset=UTF-8"%>
<%@ taglib prefix="s" uri="/struts-tags"%>
<html>
<head>
<title>Rooms List</title>
<script type="text/javascript">
      function confirmAction() {
        return confirm("Do you delete room!!!")
      }
 
</script>
</head>

<body>

	<div id="functionLabel">
		<p>Room management</p>
	</div>
	<div id="extra">
		<s:a action="addRoom">Add Room</s:a>		
	</div>
	<table id="customers">
		<tr class="even">
			<th>Room Name</th>
			<th>Floor</th>
			<th>Room Number</th>
			<th>Building</th>
			<th>Status</th>
			<th>Edit</th>
			<th>Delete</th>
		</tr>
		
		<s:iterator value="listRooms" status="roomStatus" id="listRooms">
			<s:if test="#roomStatus.even == true">
				<tr class="evenRow">
			</s:if>
			<s:else>
				<tr class="oddRow">
			</s:else>
			<td><s:property value="roomname" /></td>
			<td><s:property value="floor" /></td>
			<td><s:property value="roomNumber" /></td>
			<td><s:property value="building" /></td>
			<td><s:property value="status" /></td>
			<td>
			<s:url id="editURL" action="editRoom">
			<s:param name="id" value="%{id}"></s:param>
			</s:url>
			<s:a cssClass="editLink" href="%{editURL}"></s:a>
			</td>
			<td>
			<s:url id="deleteURL" action="deleteRoom">
			<s:param name="id" value="%{id}"></s:param>
			</s:url>
			<s:a cssClass="delLink" href="%{deleteURL}" onclick="return confirmAction()"></s:a>
			</td>
			</s:iterator>
	</table>
	

</body>
</html>